﻿<template>
    <elm-page-bb>
        <el-form ref="model" :model="model" label-width="60px" size="small">
            <el-form-item label="编码" prop="dict_type" :rules="[{ required: true, message: '编码必须填写'}]">
                <el-input v-model="model.dict_type"></el-input>
            </el-form-item>
            <el-form-item label="名称" prop="dict_name" :rules="[{ required: true, message: '名称必须填写'}]">
                <el-input v-model="model.dict_name"></el-input>
            </el-form-item>
        </el-form>
        <template slot="bottom">
            <el-button type="success" size="small" @click="submit">立即保存</el-button>
            <el-button @click="close" size="small">取消</el-button>
        </template>
    </elm-page-bb>
</template>

<script>
export default {
    extends: elmVueBase,
    data() {
        return {
            model: {}
        }
    },
    created() {
    },
    methods: {
        async submit() {
            await this.$refs["model"].validate();
            let res = await this.post('/system/dict/type/Upsert', this.model);
            if (res > 0) {
                this.close();
                this.v('保存成功。');
                this.request.callVue.treebinding();
            } else {
                this.error('保存失败，请稍后尝试。');
            }
        }
    }
}
</script>

<style scoped>
</style>